package com.fs.controller;

import com.fs.pojo.User;
import com.fs.service.UserService;
import com.fs.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/user")
public class UserCenterController extends BaseController {

    @Autowired
    private UserService userService;

    @PutMapping("/pwd")
    public ResultVO pwd(@RequestBody Map<String,String> map){
        return userService.pwd(map,getUser());
    }

    @PutMapping("/info")
    public ResultVO info(){
        User user = new User();
        user.setUsername(getUser().getUsername())
                .setEmail(getUser().getEmail());
        return ResultVO.success(user);
    }

}
